package com.cxrj.zhsq.civilianManage.controller;

import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.cxrj.zhsq.civilianManage.entity.RelevantDepartments;
import com.cxrj.zhsq.civilianManage.service.RelevantDepartmentsService;

@RestController
@RequestMapping("/RD")
public class RelevantDepartmentsController {
	
	@Resource
	private RelevantDepartmentsService relevantDepartmentsService;
	
	/**
	 * 查询所有
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value="selectRdPage",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
	public Map<String, Object> selectRdPage(HttpServletRequest request,HttpServletResponse response){
		return relevantDepartmentsService.selectRdPage(request,response);
	}
	/**
	 * 添加数据
	 * @param relevantDepartments
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("insertRd")
	public Map<String, Object> insertRd(RelevantDepartments relevantDepartments,HttpServletRequest request,HttpServletResponse response){
		return relevantDepartmentsService.insertRd(relevantDepartments,request,response);
	}
	
	/**
	 * 根据ID查询
	 * @param rdId
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("selectById")
	public Map<String, Object> selectById(String rdId,HttpServletRequest request,HttpServletResponse response){
		return relevantDepartmentsService.selectById(rdId,request,response);
	}
	
	/**
	 * 更新数据
	 * @param relevantDepartments
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("updateRd")
	public Map<String, Object> updateRd(RelevantDepartments relevantDepartments,HttpServletRequest request,HttpServletResponse response){
		return relevantDepartmentsService.updateRd(relevantDepartments,request,response);
	}
	
	@RequestMapping("deleteRd")
		public Map<String, Object> deleteRd(String rdId){
			return relevantDepartmentsService.deleteRd(rdId);
		}
	
	
	/**
	 * 添加号码
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("insertTel")
	public Map<String, Object> insertTel(HttpServletRequest request,HttpServletResponse response){
		return relevantDepartmentsService.insertTel(request,response);
	}
	
	/**
	 * 查询号码
	 * @param rdId
	 * @return
	 */
	@RequestMapping("selectByRdId")
	public Map<String, Object> selectByRdId(String rdId){
		return relevantDepartmentsService.selectRdById(rdId);
	}
	
	/**
	 * 删除号码
	 * @param tid
	 * @return
	 */
	@RequestMapping("deleteTelById")
	public Map<String, Object> deleteTelById(String tid){
		return relevantDepartmentsService.deleteTelById(tid);
	}
}
